package cn.com.darly.videoandroidpm.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.darly.common.ParentAdapter;
import com.darly.dview.widget.camera.util.ImageLoaderUtil;

import java.util.List;

import cn.com.darly.videoandroidpm.R;
import cn.com.darly.videoandroidpm.bean.LoginInfo;

/** 带标签的ListView适配器
 * @author Darly/张宇辉/2018/5/7 11:29
 * @version 1.0/cn.com.darly.videoandroidpm.ui.adapter
 */
public class AddFriendAdapter extends ParentAdapter<LoginInfo> {


    public AddFriendAdapter(List<LoginInfo> data, int resID, Context context) {
        super(data, resID, context);
    }

    @Override
    public View HockView(int position, View view, ViewGroup parent, int resID, Context context, LoginInfo info) {
        UserHolder holder = null;
        if (view == null){
            view = LayoutInflater.from(context).inflate(resID,null);
            holder = new UserHolder();
            holder.id_add_friend_icon = view.findViewById(R.id.id_add_friend_icon);
            holder.id_add_friend_note = view.findViewById(R.id.id_add_friend_note);
            view.setTag(holder);
        }else {
            holder = (UserHolder) view.getTag();
        }

        ImageLoaderUtil.getInstance().loadImageNor(info.getIcon(),holder.id_add_friend_icon);
        holder.id_add_friend_note.setText(info.getName());
        return view;
    }

    class UserHolder{
        ImageView id_add_friend_icon;
        TextView id_add_friend_note;
    }

}